
project('examples', 'c', 'cpp', version : '1.0.1')
path_prefix = './'
libssl_dep = dependency('libssl')
openssl_dep = dependency('openssl')
libcrypto_dep = dependency('libcrypto')
libwget_dep = dependency('libwget')
json_glib_dep = dependency('json-glib-1.0')
json_c_dep = dependency('json-c')
sqlite3_dep = dependency('sqlite3')
libmicrohttpd_dep = dependency('libmicrohttpd')
libmodbus_dep = dependency('libmodbus')
libdl_dep = dependency('dl')
libxml2_dep = dependency('libxml-2.0')
libmosquitto_dep = dependency('libmosquitto')
libmagic_dep = dependency('libmagic')
libwebsockets_dep = dependency('libwebsockets')
if host_machine.cpu_family() == 'x86_64'
libpng_dep = dependency('libpng')
darknet_dep = dependency('darknet')
endif

libgpiod_dep = dependency('libgpiod')
if get_option('ffmpeg')
libffmpeg_dep = []
libavformat_dep = dependency('libavformat')
libavutil_dep = dependency('libavutil')
libavdevice_dep = dependency('libavdevice')
libavfilter_dep = dependency('libavfilter')
libavcodec_dep = dependency('libavcodec')
libswscale_dep = dependency('libswscale')
libffmpeg_dep = [libavutil_dep, libavformat_dep, libavdevice_dep,
  libavfilter_dep, libavcodec_dep, libswscale_dep]
endif
if host_machine.cpu_family() == 'x86_64'
  yajl_dep = dependency('yajl')
endif
pthread_dep = []
ld_args = []
if get_option('ld_reset')
  ld_args = ['-Wl,-dynamic-linker,/home/ts/gitee/aarch64-lib/lib/ld-linux-aarch64.so.1']
  message('reset ld')
endif
lib_target = []
program_target = []
subdir('src')
subdir_versions = [
  ['example', '0.0.1'],
  ]
if host_machine.cpu_family() == 'aarch64'
subdir('aarch64')
elif host_machine.cpu_family() == 'arm'
subdir('arm')
elif host_machine.cpu_family() == 'x86_64'
subdir('x86_64')
else
endif
install_flag=true
foreach item: subdir_versions
  target_name=item[0]
  target_version=item[1]
  args_name = '-DSOFTWARE_NAME="@0@"'.format(target_name)
  args_version = '-DVERSION="@0@"'.format(target_version)
  c_args = [args_name, args_version]
  #path_prefix + get_option('bin_prefix') + target_name + get_option('bin_suffix'),
  install_dir = path_prefix + '/bin'
  subdir(item[0])
  program_target += [target_name, target_version]
endforeach
target += program_target
now_target = program_target
#now_target += ['libffmpeg', '0.0.1']
message('Source root: ' + meson.current_build_dir())
message('Build root: ' + meson.current_source_dir())
shell_path = meson.project_source_root()+'/../shell'
shellscript = shell_path + '/deb.sh'
custom_target(
  'deb',
  command: ['bash', shellscript,
    meson.current_build_dir(), now_target],
  output: 'deb.txt'
)
